﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Application.Services;
using Domaine.Contracts;
using Domaine.Core;
using Infastructure.CrossCutting;
using Infrastructure.Data.Repository;
using Infrastructure.Data.UnitOfWork;
using Microsoft.Practices.Unity;

namespace DistributedServices.MembershipModule.InstanceProvider
{

    /// <summary>
    /// DI Container 
    /// </summary>
    public static class Container
    {
        #region Properties

        static IUnityContainer _currentContainer;

        /// <summary>
        /// Get the current configured container
        /// </summary>
        /// <returns>Configured container</returns>
        public static IUnityContainer Current
        {
            get
            {
                return _currentContainer;
            }
        }

        #endregion

        #region ctor

        static Container()
        {
            _currentContainer = DistributedServices.Core.InstanceProvider.RootContainer.Current ;
            _currentContainer.RegisterType<IAppMembershipService, AppMembershipService>();
            _currentContainer.RegisterType<IAppMembershipProvider, AppMembershipProvider>();
            _currentContainer.RegisterType<IMemberShipRepository, MemberShipRepository>();
            _currentContainer.RegisterType<IUserRepository, UserRepository>();
            _currentContainer.RegisterType<IAspApplicationRepository, AspApplicationRepository>();
            _currentContainer.RegisterType<IMembershipUnitOfWork, MembershipUnitOfWork>();
            _currentContainer.RegisterType<IMembershipService, MembershipService>();
            
            
        }

        #endregion

        
    }
}
